<%@ Control Language="C#" AutoEventWireup="true"
	Inherits="System.Web.Mvc.ViewUserControl<ETestIT.Web.Controllers.ClientsController.ClientFormViewModel>" %>
<%@ Import Namespace="ETestIT.Core" %>
<%@ Import Namespace="ETestIT.Web.Controllers" %>
<%@ Import Namespace="MvcContrib.FluentHtml" %>

 

<% if (ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] != null) { %>
    <p id="pageMessage"><%= ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()]%></p>
<% } %>

<%= Html.ValidationSummary() %>

<% using (Html.BeginForm()) { %>
    <%= Html.AntiForgeryToken() %>
    <%= Html.Hidden("Client.Id", (ViewData.Model.Client != null) ? ViewData.Model.Client.Id : 0)%>

			<label for="Client_Name">Name:</label>
				<%= Html.TextBox("Client.Name", 
					(ViewData.Model.Client != null) ? ViewData.Model.Client.Name.ToString() : "")%>

			<label for="Client_ContactInformation">ContactInformation:</label>
				<%= Html.TextBox("Client.ContactInformation", 
					(ViewData.Model.Client != null) ? ViewData.Model.Client.ContactInformation.ToString() : "")%>

			<label for="Client_TypeOfClient">TypeOfClient:</label>

				<%= this.Select("Client.TypeOfClient").Attr("size", 1).Options<ClientType>()%>

            <%= Html.SubmitButton("btnSave", "Save") %>
	        <%= Html.Button("btnCancel", "Cancel", HtmlButtonType.Button, 
				    "window.location.href = '" + Html.BuildUrlFromExpression<ClientsController>(c => c.Index(null)) + "';") %>
<% } %>
